package drds.global_transaction.api.rpc.config;

import drds.global_transaction.config.Configuration;
import drds.global_transaction.config.ConfigurationFactory;
import org.apache.commons.lang.StringUtils;

public class Config
{
	protected static final Configuration CONFIG = ConfigurationFactory.getInstance();
	protected static final int max_write_idle_seconds = 0;
	protected static final int max_read_idle_seconds = max_write_idle_seconds * 3;
	protected static final int max_all_idle_seconds = 0;

	protected static int worker_thread_size;

	static
	{
		String workerThreadSize = CONFIG.getConfig("transport.thread-factory.worker-thread-size");
		if (StringUtils.isNotBlank(workerThreadSize) && StringUtils.isNumericSpace(workerThreadSize))
		{
			worker_thread_size = Integer.parseInt(workerThreadSize);
		} else if (null != WorkThreadMode.getModeByName(workerThreadSize))
		{
			worker_thread_size = WorkThreadMode.getModeByName(workerThreadSize).getValue();
		} else
		{
			worker_thread_size = WorkThreadMode.Default.getValue();
		}

	}

}
